package ${basePackageName}.serviceImpl${spotAndSubPack};

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ${basePackageName}.dao.${subPackAndclassName}Dao;
import ${basePackageName}.service.${subPackAndclassName}Service;
import ${basePackageName}.utils.CommUtils;
import ${basePackageName}.vo.Page;
import ${basePackageName}.vo.PageVo;
import ${basePackageName}.vo.${subPackAndclassName}Vo;

/**
 * <p></p>
 * <p>@Author：${company} - ${author} </p>
 * <p>@Date：${nowDate?string("yyyy年MM月dd日 HH:mm:ss")} </p>
 */
@Service
public class ${className}ServiceImpl implements ${className}Service {

	@Autowired
	private ${className}Dao ${classNameLower}Dao;

	@Override
	public PageVo<${className}Vo> query(${className}Vo ${classNameLower}Vo, Page page) {
		Map<String, Object> paramMap = CommUtils.transBean2Map(${classNameLower}Vo, page);
		List<${className}Vo> list = ${classNameLower}Dao.query(paramMap);

		PageVo<${className}Vo> pv = new PageVo<${className}Vo>();
		int count = ${classNameLower}Dao.queryCount(paramMap);

		pv.setData(list);
		pv.setPageNo(page.getPageNo());
		pv.setShowCount(page.getShowCount());
		pv.setRecordSize(count);
		pv.setShowField(page.getShowField());

		return pv;
	}

	@Override
	public int queryCount(${className}Vo ${classNameLower}Vo) {
		Map<String, Object> paramMap = CommUtils.transBean2Map(${classNameLower}Vo);
		return ${classNameLower}Dao.queryCount(paramMap);
	}
	
	@Override
	public ${className}Vo getById(String ${pKey[1]}) {
		return ${classNameLower}Dao.getById(${pKey[1]});
	}

	@Override
	public void add(${className}Vo ${classNameLower}Vo) {
		${classNameLower}Dao.add(${classNameLower}Vo);
	}

	@Override
	public void update(${className}Vo ${classNameLower}Vo) {
		${classNameLower}Dao.update(${classNameLower}Vo);
	}
	
	@Override
	public void delete(String ${pKey[1]}) {
		${classNameLower}Dao.delete(${pKey[1]});
	}
}